package com.mydemo.design_pattern.action_type.observer_pattern.impl;

import com.mydemo.design_pattern.action_type.observer_pattern.Observer;
import com.mydemo.design_pattern.action_type.observer_pattern.Subject;

/**
 * <p></p >
 *
 * @author liming1
 * @version $Id: BinaryObserver, v1.0 2019-09-23 15:05 liming1 Exp $
 */
public class BinaryObserver  extends Observer {

    public BinaryObserver(Subject subject){
        this.subject = subject;
        this.subject.addObserver(this);
    }

    @Override
    public void update() {
        System.out.println( "Binary String: "
                + Integer.toBinaryString( subject.getState() ) );
    }
}
